<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>test</title>
    <script type="text/javascript" src="/resources/js/zepto.min.js"></script>
</head>
<body>
<button id="bodyTest">bodyTest</button>
<button id="redisTest">redisTest</button>
<button id="myBatisTest">myBatisTest</button>
<button id="pushTest">pushTest</button>
<button id="transactionTest">transactionTest</button>
<button id="clearAllCache">clearAllCache</button>
<ul></ul>
<script type="text/javascript">
    $(function () {
        //alert('1');
    });

    $("#bodyTest").click(function () {
        var params = {
            "random" : Math.random(),
            "body" : {
                "name" : "百联",
                "age" : "11",
                "code" : "11"
            },
            "page" : {
                pageNo : '1',
                pageSize : '10'
            }
        };

        $.ajax({
            type : "GET",
            url : "/ajax/bodyTest",
            data : params,
            success : function(obj) {
                if(obj.status=="1001") {
                    $.each(obj.data,function(i,n){
                        alert(i + ':' + n);
                    });
                }else{
                    alert(obj.msg);
                }
            },
            error : function(data) {
                alert('fail');
            }
        });
    });

    $("#pushTest").click(function () {
        var params = {
            "random" : Math.random(),
            "body" : {
                "name" : "百联"
            }
        };

        $.ajax({
            type : "GET",
            url : "/ajax/pushTest",
            data : params,
            success : function(obj) {
                if(obj.status=="1001") {
                    alert('success');
                }else{
                    alert(obj.msg);
                }
            },
            error : function(data) {
                alert('fail');
            }
        });
    });

    $("#transactionTest").click(function () {
        var params = {
            "random" : Math.random(),
            "body" : {
                "name" : "百联"
            }
        };

        $.ajax({
            type : "GET",
            url : "/ajax/transactionTest",
            data : params,
            success : function(obj) {
                if(obj.status=="1001") {
                    alert('success');
                }else{
                    alert(obj.msg);
                }
            },
            error : function(data) {
                alert('fail');
            }
        });
    });

    $("#clearAllCache").click(function () {
        var params = {
            "random" : Math.random(),
            "body" : {
                "name" : "百联"
            }
        };

        $.ajax({
            type : "GET",
            url : "/ajax/clearAllCache",
            data : params,
            success : function(obj) {
                if(obj.status=="1001") {
                    alert('success');
                }else{
                    alert(obj.msg);
                }
            },
            error : function(data) {
                alert('fail');
            }
        });
    });

    $("#redisTest").click(function () {
        var type = "quality";

        $.ajax({
            type : "GET",
            url : "/ajax/baseData/" + type,
            dataType : "json",
            success : function(obj) {
                if(obj.status=="1001") {
                    $.each(obj.data,function(i,n){
                        alert(i + ':' + n.code  + ':' + n.name);
                    });
                }else{
                    alert(obj.msg);
                }
            },
            error : function(data) {
                alert('fail');
            }
        });
    });

    $("#myBatisTest").click(function () {

        $.ajax({
            type : "GET",
            url : "/ajax/business/list",
            dataType : "json",
            success : function(obj) {
                if(obj.status=="1001") {
                    $.each(obj.data,function(i,n){
                        alert(i + ':' + n.gameName);
                    });
                }else{
                    alert(obj.msg);
                }
            },
            error : function(data) {
                alert('fail');
            }
        });
    });
</script>
</body>
</html>